const mongoose = require('mongoose')
//连接数据库
mongoose.connect('mongodb://localhost:27017/h52002', {useNewUrlParser: true})

//创建schema
//保存人员信息
const userSchema = new mongoose.Schema({
  name: String,
  sex: String,
  birthday: Date,
  cid: String,
  phone: String
})

//根据人员信息的schema创建人员的module
//会自动将'users'作为mongodb数据中的集合的名称
 const User = mongoose.model('user', userSchema)

 //导出
 module.exports = {
     User
 }